package com.ganmiao.enums;

import lombok.Getter;

@Getter
public enum BizTypeEnums {
    //1商超；2供应商；3总后台
    BIZ_TYPE_SHOP(1, "shop"),
    BIZ_TYPE_SUPPLIER(2, "supplier"),
    BIZ_TYPE_PLATFORM(3, "platform"),
    ;

    private final Integer code;
    private final String name;

    BizTypeEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    // 根据code获取枚举实例
    public static BizTypeEnums getByCode(Integer code) {
        for (BizTypeEnums type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid BizTypeEnums: code= " + code);
    }
}
